home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / WinCE / SDKWindowsCE / HandHeldPCPro30 / sdk.exe / Jupiter SDK / data1.cab / MFC_Samples / npp / mainfrm.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1999-02-19  |  2.2 KB  |  91 lines

  1. // mainfrm.cpp : implementation of the CMainFrame class
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "np.h"
  6. #include "mainfrm.h"
  7. #include "npdoc.h"
  8.  
  9. #ifdef _DEBUG
  10. #undef THIS_FILE
  11. static char BASED_CODE THIS_FILE[] = __FILE__;
  12. #endif
  13.  
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CMainFrame
  16.  
  17. IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
  18.  
  19. BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
  20.     //{{AFX_MSG_MAP(CMainFrame)
  21.     ON_WM_CREATE()
  22.     //}}AFX_MSG_MAP
  23. END_MESSAGE_MAP()
  24.  
  25. /////////////////////////////////////////////////////////////////////////////
  26. // CMainFrame construction/destruction
  27.  
  28. CMainFrame::CMainFrame()
  29. {
  30. }
  31.  
  32. CMainFrame::~CMainFrame()
  33. {
  34. }
  35.  
  36. /////////////////////////////////////////////////////////////////////////////
  37. // CMainFrame diagnostics
  38.  
  39. #ifdef _DEBUG
  40. void CMainFrame::AssertValid() const
  41. {
  42.     CFrameWnd::AssertValid();
  43. }
  44.  
  45. void CMainFrame::Dump(CDumpContext& dc) const
  46. {
  47.     CFrameWnd::Dump(dc);
  48. }
  49.  
  50. #endif //_DEBUG
  51.  
  52. /////////////////////////////////////////////////////////////////////////////
  53. // CMainFrame message handlers
  54.  
  55. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) 
  56. {
  57.     if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
  58.         return -1;
  59.  
  60. #if defined(_WIN32_WCE_PSPC) // MFC for Palm-Size PC
  61.     if(!m_wndCommandBar.Create(this) ||
  62.        !m_wndCommandBar.InsertMenuBar(IDR_MAINFRAME) ||
  63.        !m_wndCommandBar.AddAdornments() ||
  64.        !m_wndCommandBar.LoadToolBar(IDR_MAINFRAME))
  65.     {
  66.         TRACE0("Failed to create CommandBar\n");
  67.         return -1;      // fail to create
  68.     }
  69. #elif(_WIN32_WCE > 200) // MFC for Windows CE 2.01 and later
  70.     if(!m_wndCommandBar.Create(this) ||
  71.        !m_wndCommandBar.InsertMenuBar(IDR_MAINFRAME) ||
  72.        !m_wndCommandBar.InsertSeparator(6) ||
  73.        !m_wndCommandBar.LoadToolBar(IDR_MAINFRAME) ||
  74.        !m_wndCommandBar.AddAdornments())
  75.     {
  76.         TRACE0("Failed to create CommandBar\n");
  77.         return -1;      // fail to create
  78.     }
  79. #else // MFC for Windows CE 1.0 and 2.0
  80.     int nNumButtons = sizeof(g_arCBButtons)/sizeof(TBBUTTON);
  81.     if(!InsertButtons(g_arCBButtons, nNumButtons, IDR_MAINFRAME, 6) ||
  82.        !AddAdornments(0))
  83.     {
  84.         TRACE0("Failed to create CommandBar\n");
  85.         return -1;      // fail to create
  86.     }
  87. #endif
  88.  
  89.     return 0;
  90. }
  91.